unit sm_sclass;

interface

uses dialogs, sysutils, windows;

type
  scenrec = record
   name:string;
   players:integer;
   sdate:TDateTime;
  end;

  CScen = class
   count:integer;
   dirname: string;
   scens:array[1..1000] of scenrec;
   constructor create;
//   destructor destroy; override;
  end;


implementation

constructor CScen.create;
var
 srec: TSearchRec;
 a: string;
 res: integer;
 fh: longint;
 item: scenrec;
begin
 count:=0;
 getdir(0,dirname);
 dirname := dirname + '\scenario\';
 fillchar(scens,sizeof(scens),0);
 res:=FindFirst(dirname+'*.*',faanyfile, SRec);
 repeat
   if (srec.attr<>Fadirectory) then  begin
    a := ansiuppercase(extractfileext(srec.name));
    if a='.SCN' then begin
     count := count + 1;
     item.name := srec.Name;
     fh:=CreateFile(pchar(dirname+srec.name),GENERIC_READ,FILE_SHARE_READ,nil,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
     item.sdate:=FileDateToDateTime(filegetdate(fh));
     closehandle(fh);
     scens[count] := item;
    end;
   end;
   if res = 0 then res:=findnext(srec);
 until res<>0;
 //FindClose(srec);
end;

end.
